﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
using System.Linq;
using System.Text;
using System.Reflection;

namespace PickGold.Base.Proxies
{
	/// <summary>
	/// 
	/// </summary>
	public sealed class PropertiesProxyEventArgs : EventArgs
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="msg"></param>
		public PropertiesProxyEventArgs(IMethodCallMessage msg)
		{
			this._Args = msg.Args;
			this._InArgs = msg.InArgs;
			this._Method = msg.MethodBase;
			this._MethodName = msg.MethodName;
			this._MethodSignature = msg.MethodSignature;
			this._TypeName = msg.TypeName;
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="msg"></param>
		public PropertiesProxyEventArgs(IMethodReturnMessage msg)
		{
			this._Args = msg.Args;
			this._OutArgs = msg.OutArgs;
			this._Method = msg.MethodBase;
			this._MethodName = msg.MethodName;
			this._MethodSignature = msg.MethodSignature;
			this._TypeName = msg.TypeName;
			this._Exception = msg.Exception;
			this._ReturnValue = msg.ReturnValue;
		}

		/// <summary>
		/// 所有参数。
		/// </summary>
		public object[] Args
		{
			get
			{
				return this._Args;
			}
		}

		/// <summary>
		/// 所有输入参数。
		/// </summary>
		public object[] InArgs
		{
			get
			{
				return this._InArgs;
			}
		}

		/// <summary>
		/// 所有输出参数。
		/// </summary>
		public object[] OutArgs
		{
			get
			{
				return this._OutArgs;
			}
		}

		/// <summary>
		/// 返回值。
		/// </summary>
		public object ReturnValue
		{
			get
			{
				return this._ReturnValue;
			}
		}

		/// <summary>
		/// 处理异常。
		/// </summary>
		public Exception Exception
		{
			get
			{
				return this._Exception;
			}
		}

		/// <summary>
		/// 调用方法。
		/// </summary>
		public MethodBase Method
		{
			get
			{
				return this._Method;
			}
		}

		/// <summary>
		/// 类型名称。
		/// </summary>
		public string TypeName
		{
			get
			{
				return this._TypeName;
			}
		}

		/// <summary>
		/// 调用方法名。
		/// </summary>
		public string MethodName
		{
			get
			{
				return this._MethodName;
			}
		}

		/// <summary>
		/// 方法调用约定。
		/// </summary>
		public object MethodSignature
		{
			get
			{
				return this._MethodSignature;
			}
		}

		private object[] _Args;
		private object[] _InArgs;
		private object[] _OutArgs;
		private object _ReturnValue;
		private Exception _Exception;
		private MethodBase _Method;
		private string _TypeName;
		private string _MethodName;
		private object _MethodSignature;
	}

	public delegate void PropertiesProxyEventHandler(object sender, PropertiesProxyEventArgs e);
}
